home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3423 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  33 lines

  1. Newsgroups: comp.lang.c
  2. Path: mxsld2.pd.infn.it!LORETI
  3. From: loreti@mxsld2.pd.infn.it (Maurizio Loreti)
  4. Subject: Re: Basic Question on SWITCH
  5. X-Nntp-Posting-Host: mxsld2.pd.infn.it
  6. Message-ID: <DLwvCz.L78@news.cern.ch>
  7. Sender: news@news.cern.ch (USENET News System)
  8. Reply-To: loreti@mxsld2.pd.infn.it
  9. Organization: I.N.F.N. Padova - CDF/CMS VAXcluster
  10. References: <4e4cu4$95f@vixen.cso.uiuc.edu>
  11. Date: Sun, 28 Jan 1996 21:50:57 GMT
  12.  
  13. In article <4e4cu4$95f@vixen.cso.uiuc.edu>, HOTARD <jhotard> writes:
  14. >I am just learning how to program in C, and I had a question about switch.
  15. >I am writing a program that looks at a character and then determines if it is a
  16. >letter or number.  This program must use the switch command , can I place a
  17. >range on the case command somehow??
  18. >
  19. >ie:  Switch (var)
  20. >    case 0-9:
  21. >
  22. >or case (isdigit):  
  23. >
  24. >would anything like this work???
  25.  
  26. No.
  27. Case labels must evaluate to an integer value at compile time; check
  28. your textbook.  However you may attech multiple labels to the same
  29. statement.
  30. --
  31. Maurizio Loreti                       http://mvxpd5.pd.infn.it/wwwcdf/mlo.html
  32. Un. of Padova, Dept. of Physics - Padova, Italy          loreti@padova.infn.it
  33.